local skill = fk.CreateSkill {
  name = "#ling__iron_armor_skill",
  tags = { Skill.Compulsory },
  attached_equip = "ling__iron_armor",
}

Fk:loadTranslationTable{
  ["#ling__iron_armor_skill"] = "明光铠",
}

skill:addEffect(fk.PreCardEffect, {
  can_trigger = function(self, event, target, player, data)
    return data.to == player and player:hasSkill(skill.name) and
      table.contains({"thunder__slash", "fire__slash"}, data.card.name)
  end,
  on_use = function(self, event, target, player, data)
    data.nullified = true
  end,
})

skill:addEffect(fk.CardUseFinished, {
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(skill.name) and
      data.card.name == skill.attached_equip and player.chained
  end,
  on_use = function(self, event, target, player, data)
    player:setChainState(false)
  end,
})

skill:addEffect(fk.CardEffectFinished, {
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(skill.name) and
      data.card.name == "iron_chain" and player.chained
  end,
  on_use = function(self, event, target, player, data)
    player:setChainState(false)
  end,
})

return skill
